package com.wtang.test;

import com.wtang.beans.NewsLabel01;
import com.wtang.beans.Student01;
import com.wtang.dao.INewsLabelDao2;
import com.wtang.dao.IStudentDao01;
import com.wtang.utils.MyBatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


/**
 * ClassName:MyTest
 * Package:com.wtang.test
 * Description:
 *
 * @Date:2019/7/30 23:05
 * @Author:wtang
 */
public class MyTest7 {

    private IStudentDao01 dao;
    private SqlSession sqlSession;

    @Before
    public void before(){
//        dao = new StudentDaoImpl();
//        mapper的动态代理
        sqlSession = MyBatisUtils.getSqlSession();
        dao = sqlSession.getMapper(IStudentDao01.class);
    }

    @After
    public  void after(){
        if(sqlSession != null){
            sqlSession.close();
        }
    }

    @Test
    public void test01(){
        Student01 student = dao.selectStudentById(1);
        System.out.println(student);
    }

}
